<template>
    <Tree :data="data"  @on-select-change='select'></Tree>
</template>
<script>
import { eventBus } from  "../../main.js";
export default {
    data(){
        return{
            data:[],
            children:[],
        }
    },
    methods:{
        getCateList(){
            this.axios({
                url:`${config.dataBaseUrl}cate/list/pro`,
                method:'post',
                
            }).then(res=>{
                this.data=res.data
            })
        },
        select(data){
            if(!!data[0]){
                eventBus.$emit('parentId',data[0]._id)
            }
        }
    },
    mounted(){
        this.getCateList();
    }
}
</script>
